# Contributor: Newbyte <newbie13xd@gmail.com>
# Maintainer: Newbyte <newbie13xd@gmail.com>
pkgname=amberol
pkgver=0.8.0
pkgrel=0
pkgdesc="Plays music, and nothing else"
url="https://gitlab.gnome.org/World/amberol"
# s390x and riscv64 blocked by rust/cargo
arch="all !s390x !riscv64"
license="GPL-3.0-or-later"
depends="
	gst-libav
	gst-plugins-bad
	gst-plugins-good
	"
makedepends="
	cargo
	dbus-dev
	desktop-file-utils
	gmp-dev
	gst-plugins-bad-dev
	gst-plugins-base-dev
	gstreamer-dev
	libadwaita-dev
	m4
	meson
	mpfr-dev
	"
subpackages="$pkgname-lang"
source="
	https://gitlab.gnome.org/World/amberol/-/archive/$pkgver/amberol-$pkgver.tar.gz
	001-patch-build-script.patch
	"

export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_LTO="true"
export CARGO_PROFILE_RELEASE_OPT_LEVEL="s"
export CARGO_PROFILE_RELEASE_PANIC="abort"
export CARGO_FEATURE_USE_SYSTEM_LIBS=1 # gmp-mpfr-sys links to gmp-dev and mpfr-dev
export CARGO_NET_OFFLINE="true"
export CARGO_HOME="$srcdir/cargo"

prepare() {
	default_prepare

	env -u CARGO_NET_OFFLINE cargo fetch --locked
}

build() {
	# Without buildtype=release we get a debug build for some reason
	abuild-meson \
		--buildtype=release \
		. output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

check() {
	meson test --no-rebuild -v -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
661ce38c5620b6ee3bedc1fd2f15f57189ca77208f4bb0916689d198bc1af8c8551d4bd6b154c17850260aff2133e44b81f4d7050c44f7119e7b3dc9abf79dc0  amberol-0.8.0.tar.gz
8639d9faef5fb2f17231b790fdad162a9d6cf96091b88463a6bcc6e4579e2eb44a2db60021e034f6017d422b1e2dfb274e7aaa64ada19b4fbcecb82cedd04767  001-patch-build-script.patch
"
